function alert(message) {
    var script = new ActiveXObject("MSScriptControl.ScriptControl");
    script.Language = "VBScript";
    var code = 'MsgBox("' + message + '")';
    return script.Eval(code);
}

function prompt(message, defaultValue) {
    var script = new ActiveXObject("MSScriptControl.ScriptControl");
    script.Language = "VBScript";
    var title = "";
    var code = 'Inputbox("' + message + '","' + title + '","' + defaultValue + '")';
    return script.Eval(code);
}

function confirm(message){
    var vbYesNo = 4;
    var vbYes = 6; 
    var vbNo = 7;
    
    var script = new ActiveXObject("MSScriptControl.ScriptControl");
    script.Language = "VBScript";
    var prompt = message;
    var buttons = vbYesNo;
    var title = "";
    var code = 'MsgBox("' + message + '","' + buttons + '","' + title + '")';
    var result = script.Eval(code);
    if (result == vbYes) {
        result = true;
    }
    else if (result == vbNo) {
        result = false;
    }
    return result == vbYes;
}

function now() {
    var now = new Date();
    var year = now.getFullYear().toString();
    var month = (now.getMonth() + 1).toString();
    var date = now.getDate().toString();
    var hour = now.getHours().toString();
    var minute = now.getMinutes().toString();
    if (minute == "0") {
        minute = "00";
    }
    var second = now.getSeconds().toString();
    if (second == "0") {
        second = "00";
    }
    var result = year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
    return result;
}

function dump(arr, level) {
	if (!level) { 
		level = 0; 
	}
    var dumped_text = "";
    var level_padding = "";
    for (var i = 0; i < level + 1; i++) { 
    	level_padding += "    ";
    }
    if (typeof(arr) == 'object') {  
        for (var item in arr) {
            var value = arr[item];
            if (typeof(value) == 'object') { 
                dumped_text += level_padding + "'" + item + "' ...\n";
                dumped_text += dump(value,level+1);
            } else {
                dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
            }
        }
    } else { 
        dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
    }
    return dumped_text;
}
